import request from '@/router/axios';


// 上传
export const uploadFile = (params) => {
  return request({
    url: '/api/localfiles/UploadFileInRecord',
    method: 'post',
    data: params
  })
}

// 模板列表
export const getList = (current, size, params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetQuestTempList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

// 获取模板详情
export const getDetail = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetQuestTempInfo',
    method: 'get',
    params
  })
}

// 获取类别
export const getType = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetQuestTypeIdList',
    method: 'get',
    params
  })
}

// 添加或修改模板
export const addOrUpdate = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/AddOrEditQuestTemp',
    method: 'post',
    data: params
  })
}

// 修改模板结果描述
export const editResultDesc = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/EditQuestTempResultDesc',
    method: 'post',
    data: params
  })
}

// 删除模板
export const deleteTemplate = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/DelQuestTemp',
    method: 'post',
    data: params
  })
}

// 发布或撤回模板
export const publishOrWithdraw = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/IssueOrCancelQuestTemp',
    method: 'post',
    data: params
  })
}

// 复制模板
export const copyTemplate = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/CopyQuestTemp',
    method: 'get',
    params
  })
}

// 预览模板
export const previewTemplate = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/PreviewQuestTemp',
    method: 'get',
    params
  })
}


// 设置分析维度

// 维度列表
export const getAnalyseList = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetTempAnalysisDimension',
    method: 'get',
    params
  })
}
// add维度列表
export const addAnalyseDetail = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/AddOrEditTempAnalysisDimension',
    method: 'post',
    data: params
  })
}

// 删除维度
export const deleteAnalyseDetail = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/DelTempAnalysisDimension',
    method: 'post',
    data: params
  })
}

// 获取量表纬度规则列表
export const getAnalyseRuleList = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetTempAnalysisDimensionRule',
    method: 'get',
    params
  })
}

// 添加量表纬度规则列表
export const addAnalyseRule = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/AddOrEditTempAnalysisDimensionRule',
    method: 'post',
    data: params
  })
}

// 删除量表纬度规则列表
export const delAnalyseRule = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/DelTempAnalysisDimensionRule',
    method: 'post',
    data: params
  })
}

// 获取规则下拉
export const getSelectRule = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetScaleQuestRule',
    method: 'get',
    params
  })
}


// 量表结果页
// 列表
export const getResultList = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetScaleResult',
    method: 'get',
    params
  })
}
// 个人报告
export const getPersonalReport = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetPersonalQuestionnaireReport',
    method: 'get',
    params
  })
}

// 当前用户学校拥有的模板下拉
export const getSchoolTempList = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/GetSchoolQuestTempList',
    method: 'get',
    params
  })
}

// 个人报告导出
export const exportPersonalReport = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/ExportPersonalQuestionnaireReport',
    method: 'get',
    params
  })
}

// 团体报告导出
export const exportGroupReport = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/ExportTeamQuestionnaireReport',
    method: 'get',
    params
  })
}

// 批量导出个人报告
export const exportPersonalReportBatch = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/ExportBatchPersonalQuestionnaireReport',
    method: 'get',
    params
  })
}

// 获取量表报表url
export const getReportUrl = (params) => {
  return request({
    url: '/api/ManageQuestTemplate/getMetabaseUrl',
    method: 'get',
    params
  })
}


// const api = 'http://8.142.153.155:8024' //process.env.NODE_ENV === 'development' ? '/echartsApi' : 'http://192.168.1.146:8024'
// const api = 'http://192.168.1.146:8024' //process.env.NODE_ENV === 'development' ? '/echartsApi' : 'http://192.168.1.146:8024'
const api = 'https://flower.bjsgcs.com' //process.env.NODE_ENV === 'development' ? '/echartsApi' : 'http://192.168.1.146:8024'

export const getUserInfoNew = (params) => {
  return request({
    url: `${api}/report/getUserInfo/${params.userType}`,
    method: 'get',
    // params
  })
}

// 统计省、市、县、学校、年级、班级整体完成数、完成率曲线图
export const statisticDayCount = (params) => {
  return request({
    url: `${api}/report/statisticDayCount`,
    method: 'POST',
    data: params
  })
}

//统计省、市、县、学校、年级、班级整体完成率曲线图
export const statisticDayRate = (params) => {
  return request({
    url: `${api}/report/statisticDayRate`,
    method: 'POST',
    data: params
  })
}

// 省、市、县、学校、年级、班级当天、周、月人数统计
export const statisticPeopleCount = (params) => {
  return request({
    url: `${api}/report/statisticPeopleCount`,
    method: 'POST',
    data: params
  })
}

// 省、市、县、学校-小、初、高各等级的完成率
export const statisticLevelRate = (params) => {
  return request({
    url: `${api}/report/statisticLevelRate`,
    method: 'POST',
    data: params
  })
}

// 省、市各区完成数、完成率排名柱状图
export const statisticAreaCountAndRate = (params) => {
  return request({
    url: `${api}/report/statisticAreaCountAndRate`,
    method: 'POST',
    data: params
  })
}

// 省、市、县各学校完成数、完成率排名柱状图
export const statisticSchoolCountAndRate = (params) => {
  return request({
    url: `${api}/report/statisticSchoolCountAndRate`,
    method: 'POST',
    data: params
  })
}

// 学校各年级完成数、完成率排名柱状图
export const statisticGradeCountAndRate = (params) => {
  return request({
    url: `${api}/report/statisticGradeCountAndRate`,
    method: 'POST',
    data: params
  })
}

// 年级各班级完成数、完成率排名柱状图
export const statisticClassesCountAndRate = (params) => {
  return request({
    url: `${api}/report/statisticClassesCountAndRate`,
    method: 'POST',
    data: params
  })
}

// 班级各学生完成数、完成率排名柱状图
export const statisticStudentCountAndRate = (params) => {
  return request({
    url: `${api}/report/statisticStudentCountAndRate`,
    method: 'POST',
    data: params
  })
}

// 省、市、县、学校、年级、班级-各因子等级统计
export const statisticFactorLevel = (params) => {
  return request({
    url: `${api}/report/statisticFactorLevel`,
    method: 'POST',
    data: params
  })
}

// 获取因子列表
export const getScaleList = (params) => {
  return request({
    url: `${api}/report/getScaleList`,
    method: 'POST',
    data: params
  })
}

//根据因子统计各个区、学校、年级、班级各个等级数量
export const statisticLevelCountByFactor = (params) => {
  return request({
    // url: `${api}/report/statisticLevelCountByFactor`,
    url: `${api}/report/statisticFactorCountByArea`,
    method: 'POST',
    data: params
  })
}

//获取时间范围列表
export const getDateList = (params) => {
  return request({
    url: `${api}/report/getDateList`,
    method: 'get',
    params
  })
}

//getBeijingData
export const getMapData = (params) => {
  return request({
    url: `${api}/report/getJsonData/${params.city}`,
    method: 'get'
  })
}


//各区域数据分布图
export const statisticCountByArea = (params) => {
  return request({
    url: `${api}/report/statisticCountByArea`,
    method: 'POST',
    data: params
  })
}

//各区域数据分布图
export const getTemplateList = (params) => {
  return request({
    url: `${api}/report/getTemplateList`,
    method: 'POST',
    data: params
  })
}

//根据因子统计各个区、学校、年级、班级各个等级数量
export const statisticSchoolCountByArea = (params) => {
  return request({
    // url: `${api}/report/statisticLevelCountByFactor`,
    url: `${api}/report/statisticSchoolCountByArea`,
    method: 'POST',
    data: params
  })
}

//省、市、县各学校完成数、完成率分页查询
export const statisticSchoolCountAndRatePage = (params) => {
  return request({
    url: `${api}/report/statisticSchoolCountAndRatePage`,
    method: 'POST',
    data: params
  })
}

// 需重点关注人数学校排名分页查询
export const statisticSchoolCountByAreaPage = (params) => {
  return request({
    url: `${api}/report/statisticSchoolCountByAreaPage`,
    method: 'POST',
    data: params
  })
}
// 省、市各区完成数、完成率排名分页列表
export const statisticAreaCountAndRatePage = (params) => {
  return request({
    url: `${api}/report/statisticAreaCountAndRatePage`,
    method: 'POST',
    data: params
  })
}

// 学校各年级完成数、完成率排名分页列表
export const statisticGradeCountAndRatePage = (params) => {
  return request({
    url: `${api}/report/statisticGradeCountAndRatePage`,
    method: 'POST',
    data: params
  })
}

// 年级各班级完成数、完成率排名分页列表
export const statisticClassesCountAndRatePage = (params) => {
  return request({
    url: `${api}/report/statisticClassesCountAndRatePage`,
    method: 'POST',
    data: params
  })
}

// 需重点关注学生名单(各个因子下，需要重点关注学生)
export const statisticFocusByFactor = (params) => {
  return request({
    url: `${api}/report/statisticFocusByFactor`,
    method: 'POST',
    data: params
  })
}

// 显示各个学生在各个因子下的得分明细情况
export const statisticStudentFactorDetail = (params) => {
  return request({
    url: `${api}/report/statisticStudentFactorDetail`,
    method: 'POST',
    data: params
  })
}





